#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int fork_rv;

int main()
{
	printf("Before:my pid is %d\n",getpid());

	fork_rv=fork();  //creat a new process

	if(fork_rv==-1)   //check new error
		perror("fork");

	else if(fork_rv==0){
		printf("I am the parent,my child is %d\n",getpid());
		exit(0);
	}
	else{
		printf("I am the parent,my child is %d\n",fork_rv);
		exit(0);
	}

	return 0;
}
